package me.zhengjie.modules.system.service

import jakarta.servlet.http.HttpServletResponse
import me.zhengjie.modules.system.domain.Dept
import me.zhengjie.modules.system.service.dto.DeptDTO
import me.zhengjie.modules.system.service.dto.DeptQueryCriteria
import java.io.IOException

/**
 * @author Kuki Wu
 * @date 2019-03-25
 */
interface DeptService {
    //fun queryAll(queryAll: List<DeptDTO>, response: HttpServletResponse?)
    @Throws(Exception::class)
    fun queryAll(criteria: DeptQueryCriteria, isQuery:Boolean): List<DeptDTO?>?
    fun findById(id: Long): DeptDTO?
    fun create(resources: Dept): DeptDTO?
    fun update(resources: Dept)
    fun delete(id: Long)
    fun delete(deptDTOs:Set<DeptDTO>)
    /**
     * 构建树形数据
     * @param DeptDTOs /
     * @return /
     */

    fun buildTree(deptDTOS: List<DeptDTO>): Any
    fun findByPid(pid: Long): List<Dept>
    fun findByRoleIds(id: Long): Set<Dept?>?

    @Throws(IOException::class)
    fun download(queryAll: List<DeptDTO>, response: HttpServletResponse?)

    /**
     * 获取待删除的部门
     * @param deptList /
     * @param DeptDTOs /
     * @return /
     */
    fun getDeleteDepts(menuList: List<Dept?>?, deptDTOs: MutableList<DeptDTO?>?): Set<DeptDTO?>?

    /**
     * 根据ID获取同级与上级数据
     * @param DeptDTO /
     * @param depts /
     * @return /
     */
    fun getSuperior(deptDTO: DeptDTO?, depts: MutableList<Dept?>?): List<DeptDTO?>?

    /**
     * 获取
     * @param deptList /
     * @return /
     */
    fun getDeptChildren(deptList: List<Dept?>?): List<Long?>?

    /**
     * 验证是否被角色或用户关联
     * @param DeptDTOs /
     */
    fun verification(deptDTOs: Set<DeptDTO?>?)
}